package com.itheima.test;

import com.itheima.dao.UserDao;
import com.itheima.domain.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;

public class 索引查询 {
    @Test
    public void testFindById() throws Exception{
        SqlSession sqlSession = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis-conﬁg.xml")).openSession();

        UserDao userDao = sqlSession.getMapper(UserDao.class);

        User u = userDao.findById(5);

        sqlSession.close();

        System.out.println(u);


    }
}
